home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / admin / linuxcon.000 / linuxcon / linuxconf-1.6 / apache / apache.c next >
C/C++ Source or Header  |  1996-08-01  |  1KB  |  64 lines

  1. #include <stdio.h>
  2. #include "../netconf/netconf.h"
  3. #include "internal.h"
  4.  
  5. PUBLIC MODULE_APACHE::MODULE_APACHE()
  6. {
  7.     DAEMON *dae = new DAEMON_HTTPD;
  8.     char buf[200];
  9.     sprintf (buf,"%s -f %s",VAR_LIB_WWW_BIN_HTTPD,VAR_LIB_WWW_HTTPD_CONF);
  10.     daemon_register (dae,"httpd",buf);
  11. }
  12. PUBLIC void MODULE_APACHE::setmenu (
  13.     DIALOG &dia,
  14.     MENU_CONTEXT context)
  15. {
  16.     if (context == MENU_NETWORK){
  17.         dia.new_menuitem ("Configure","general options");
  18.         dia.new_menuitem (" ","virtual domains");
  19.         dia.new_menuitem ("Manage","restricted directories");
  20.     }
  21. }
  22.  
  23. PUBLIC void MODULE_APACHE::domenu (
  24.     MENU_CONTEXT context,
  25.     const char *key)
  26. {
  27.     if (context == MENU_NETWORK){
  28.         printf ("apache was called with key %s\n",key);
  29.     }
  30. }
  31.  
  32. PUBLIC int MODULE_APACHE::probe (int state, int target)
  33. {
  34.     int ret = 0;
  35.     if (state == 2){
  36.         ret = netconf_startstop ("httpd",1);
  37.     }else if (state == 1 && target < 2){
  38.         ret = netconf_startstop ("httpd",1);
  39.     }
  40.     return ret;
  41. }
  42.  
  43. static MODULE_APACHE apache;
  44.  
  45. /*
  46.     Restart httpd if HTTPD_CONF is newer than the process
  47. */
  48. PUBLIC int DAEMON_HTTPD::startif ()
  49. {
  50.     /* #Specification: httpd / strategy
  51.         httpd depends on /etc/httpd.conf.
  52.         If the file is empty or do not exist, then httpd
  53.         is not need. It will be killed, or not started.
  54.  
  55.         If httpd.conf is not empty, it will be started. If it is
  56.         already running and httpd.conf is younger than the process,
  57.         it will be kill and restart.
  58.  
  59.     */
  60.     extern CONFIG_FILE httpd_conf;
  61.     return startif_file(httpd_conf);
  62. }
  63.  
  64.